import axios from 'axios'
const instance = axios.create({
  // baseURL: 'http:127.0.0.1:3000/api'
})
instance.interceptors.request.use((config) => {
  let userInfo = localStorage.getItem('userInfo')
  try { userInfo = JSON.parse(userInfo) || {} } catch (err) { userInfo = {} };
  if (userInfo?.authorization) config.headers.authorization = userInfo?.authorization
  return config
}, (err) => {
  return Promise.reject(err)
})
export default instance
